package com.pri.chat.adapter;

import android.view.View;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.netease.nim.uikit.net.entity.WishRecordBean;
import com.pri.chat.R;
import com.pri.chat.view.ImageViewPlus;

import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/22
 */
public class WishRecordAdapter extends BaseQuickAdapter<WishRecordBean, BaseViewHolder> {
    public WishRecordAdapter(int layoutResId, @Nullable List<WishRecordBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, WishRecordBean item) {
        helper.setText(R.id.tv_comment_time,item.getAddDate());
        helper.addOnClickListener(R.id.tv_status);
        helper.addOnClickListener(R.id.iv_logo);
        helper.addOnClickListener(R.id.tv_cancel);
//        helper.setText(R.id.tv_comment_age,item.getSex()+"  "+item.getAge()+"岁");
        if(item.getStatus()==0){
            helper.setText(R.id.tv_status,"同意");
            helper.setText(R.id.tv_cancel,"拒绝");
        }else   if(item.getStatus()==1){
            helper.setText(R.id.tv_status,"完成");
            helper.setText(R.id.tv_cancel,"未完成");
        }else   if(item.getStatus()==2){
            helper.setText(R.id.tv_status,"已完成");
            helper.getView(R.id.tv_cancel).setVisibility(View.GONE);
        }else   if(item.getStatus()==3){
            helper.setText(R.id.tv_status,"未完成");
            helper.getView(R.id.tv_cancel).setVisibility(View.GONE);
        }

        helper.setText(R.id.tv_comment_name,item.getMemberName());
        Glide.with(mContext).load(item.getHeadPic()).into((ImageViewPlus)helper.getView(R.id.iv_logo));
    }
}
